package com.cobra;


import java.util.LinkedList;
import java.util.List;

public class TreeNode {

    private String name;

    private List<TreeNode> children;

    private Long id;

    private Long parentId;

    private String value;

    private String type;

    public TreeNode(String name, Long parentId,String value,String type) {
        this.name = name;
        children = new LinkedList<>();
        id = System.currentTimeMillis();
        if(parentId == null){
            this.parentId = id;
        }else {
            this.parentId = parentId;
        }
        this.value = value;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<TreeNode> getChildren() {
        return children;
    }

    public void setChild(TreeNode child) {
        children.add(child);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
